package com.anlu.concurrent.ch08b.test;
import com.anlu.concurrent.ch08b.assist.*;
import com.anlu.concurrent.ch08b.service.ProduceDocService;
import com.anlu.concurrent.ch08b.service.question.SingleQstService;
import com.anlu.concurrent.ch08b.vo.*;
import com.anlu.concurrent.ch08b.service.question.*;

import java.util.List;

/**
 * 类说明：最初的实现，速度较慢，需要进行性能提升
 */
public class SingleWeb {


    public static void main(String[] args) {
        System.out.println("题库开始初始化...");
        SL_QuestionBank.initBank();
        System.out.println("题库初始化完成。");

        //创建两个待处理文档
        List<SrcDocVo> docList = CreatePendingDocs.makePendingDoc(2);
        long startTotal = System.currentTimeMillis();

        for (SrcDocVo doc:docList) {
            System.out.println("开始处理文档："+doc.getDocName()+".......");
            long start = System.currentTimeMillis();
            String localName = ProduceDocService.makeDoc(doc);
            System.out.println("文档"+localName+"生成耗时："
                    +(System.currentTimeMillis()-start)+"ms");
            start = System.currentTimeMillis();
            String remoteUrl = ProduceDocService.upLoadDoc(localName);
            System.out.println("已上传至["+remoteUrl+"]耗时："
                    +(System.currentTimeMillis()-start)+"ms");
        }
        System.out.println("------------共耗时："
                +(System.currentTimeMillis()-startTotal)+"ms-------------");
    }

}
